﻿using System;
using System.Data;
using System.Data.OracleClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class CostManage_LocationAdd : UserPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Attribute_Bind();
            Dep_Bind();
            Auth();
            SetPager();
            SetPagerUn();
        }
    }

    private void Attribute_Bind()
    {
        BuildDate.Attributes.Add("onclick", "WdatePicker({el:$dp.$('BuildDate')});");
    }

    private void SetPager()
    {
        PagedDataSource pds = new PagedDataSource();
        DataSet ds = GetLocation();
        LocationPager.RecordCount = ds.Tables[0].Rows.Count;
        pds.DataSource = ds.Tables[0].DefaultView;
        pds.AllowPaging = true;
        pds.PageSize = LocationPager.PageSize;
        pds.CurrentPageIndex = LocationPager.CurrentPageIndex - 1;
        LocationList.DataSource = pds;
        LocationList.DataBind();
    }

    private void SetPagerUn()
    {
        PagedDataSource pds = new PagedDataSource();
        DataSet ds = GetUnCell();
        UnCellPager.RecordCount = ds.Tables[0].Rows.Count;
        pds.DataSource = ds.Tables[0].DefaultView;
        pds.AllowPaging = true;
        pds.PageSize = UnCellPager.PageSize;
        pds.CurrentPageIndex = UnCellPager.CurrentPageIndex - 1;
        UnCellList.DataSource = pds;
        UnCellList.DataBind();
    }  

    private DataSet GetLocation()
    {
        string sqlStr = @"SELECT A.PHYSICAL_NAME,B.Count2G,C.Count3G,A.Cell_Type,A.CellOwner,A.MAINTER
                              from U_PHYSICAL_LOCATION_T A
                              LEFT JOIN (SELECT COUNT(Cell_Chname) AS Count2G,PHYSICAL_NAME
                                           FROM u_cell_rela_t WHERE Status = '正常'
                                            AND CELL_CLASSIFICATION = '2G'
                                          GROUP BY PHYSICAL_NAME) B
                                on A.PHYSICAL_NAME = B.PHYSICAL_NAME
                              LEFT JOIN (SELECT COUNT(Cell_Chname) AS Count3G,PHYSICAL_NAME
                                           FROM u_cell_rela_t WHERE Status = '正常'
                                            AND CELL_CLASSIFICATION = '3G'
                                          GROUP BY PHYSICAL_NAME) C
                                on A.PHYSICAL_NAME = C.PHYSICAL_NAME
                            INNER JOIN u_cell_rela_t D
                                ON A.PHYSICAL_NAME = D.PHYSICAL_NAME
                              AND D.Status = '正常' ";
        if (Dep_A.SelectedValue != "0")
        {
            sqlStr += " and D.CELL_CHNAME like '" + Dep_A.SelectedValue + "%'";
        }
        if (Cell_CHName_A.Text.Trim().Length > 0)
        {
            sqlStr += " and D.CELL_CHNAME like '%" + Tools.ReplaceString(Cell_CHName_A.Text.Trim(), 50) + "%'";
        }
        sqlStr += @" where A.Status = '正常' group by A.PHYSICAL_NAME,B.Count2G,C.Count3G,A.Cell_Type,A.CellOwner,A.MAINTER";
        return OracleHelper.ExecuteDataSet(sqlStr, CommandType.Text, null);
    }

    private DataSet GetUnCell()
    {
        string sqlStr = @"select SUBSTR(CELL_CHNAME,0,2) AS COUNTY,CELL_CHNAME,cell_address
                                ,CELL_CLASS,CELL_CLASSIFICATION
                              from CELL_CLASS A 
                             where not exists(select 1 from u_cell_rela_t B where A.CELL_CHNAME = B.CELL_CHNAME and B.Status='正常') ";
        if (Dep_A.SelectedValue != "0")
        {
            sqlStr += " and cell_chname like '" + Dep_A.SelectedValue + "%' "; 
        }
        if (Cell_CHName_A.Text.Trim().Length > 0)
        {
            sqlStr += " and CELL_CHNAME like '%" + Tools.ReplaceString(Cell_CHName_A.Text.Trim(), 50) + "%' ";
        }
        return OracleHelper.ExecuteDataSet(sqlStr, CommandType.Text, null);
    }

    private void Dep_Bind()
    {
        string sqlstr = "SELECT DISTINCT SUBSTR(Replace(CELL_CHNAME,'G',''),0,2) AS County FROM CELL_CLASS ORDER BY SUBSTR(Replace(CELL_CHNAME,'G',''),0,2)";
        Dep_A.DataSource = OracleHelper.ExecuteDataSet(sqlstr, CommandType.Text, null).Tables[0].DefaultView;
        Dep_A.DataTextField = "County";
        Dep_A.DataValueField = "County";
        Dep_A.DataBind();
        Dep_A.Items.Insert(0, new ListItem("全市", "0"));
    }

    private void Auth()
    {
        DataRow dr = GetOrganAndCompany().Rows[0];
        if ((!dr["company"].ToString().Equals("延安")) || dr["organ"].ToString().Equals("宝塔维护站"))
        {
            Dep_A.SelectedValue = dr["company"].ToString();
        }
        else
        {
            Dep_A.Enabled = true;
        }
    }

    protected void QueryLocation_Click(object sender, EventArgs e)
    {
        SetPager();
        SetPagerUn();
    }

    protected void Location_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Show")
        {
            ShowLocation(e);
        }
        else if (e.CommandName == "ModifyLocation")
        {
            ModifyLocation(e);
        }
        else if (e.CommandName == "DeleteLocation")
        {
            DeleteLocation(e);
        }
    }

    private void ShowLocation(GridViewCommandEventArgs e)
    {
        Location_Bind(e);
        CellList_Bind(e.CommandArgument.ToString());
        BtnCreate.Visible = true;
        BtnCreate.Enabled = false;
        BtnModify.Visible = false;
        PHYSICAL_NAME.ReadOnly = false;
        Page.ClientScript.RegisterStartupScript(this.GetType(), "open"
            , "$(function() {$('#LocationDiv').dialog('open');})", true);
    }

    private void ModifyLocation(GridViewCommandEventArgs e)
    {
        Location_Bind(e);
        CellList_Bind(e.CommandArgument.ToString());        
        BtnCreate.Visible = false;
        BtnModify.Visible = true;
        PHYSICAL_NAME.ReadOnly = true;
        Page.ClientScript.RegisterStartupScript(this.GetType(), "open"
            , "$(function() {$('#LocationDiv').dialog('open');})", true);
    }

    private void DeleteLocation(GridViewCommandEventArgs e)
    {
        string sqlStr = "UPDATE U_PHYSICAL_LOCATION_T SET Status = '删除' WHERE PHYSICAL_NAME = :PHYSICAL_NAME";        
        OracleParameter[] _params = {
            new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128)
        };
        _params[0].Value = e.CommandArgument.ToString();
        OracleHelper.ExecuteNonQuery(sqlStr, CommandType.Text, _params);
        SetPager();
        SetPagerUn();
        OldRela(e.CommandArgument.ToString());
        JQueryAlert("物理站址删除成功！");
    }

    private void Location_Bind(GridViewCommandEventArgs e)
    {
        string sqlStr = "select * from U_PHYSICAL_LOCATION_T WHERE PHYSICAL_NAME = :PHYSICAL_NAME";
        OracleParameter[] _params = {
                    new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128)
                };
        _params[0].Value = e.CommandArgument.ToString();
        DataRow dr = OracleHelper.ExecuteDataSet(sqlStr, CommandType.Text, _params).Tables[0].Rows[0];
        PHYSICAL_NAME.Text = dr["PHYSICAL_NAME"].ToString();
        if (dr["CellOwner"].ToString().Equals("联通"))
        {
            Ownership.SelectedValue = dr["Ownership"].ToString();
            PowerJoin.SelectedValue = dr["PowerJoin"].ToString();
            PowerModel.SelectedValue = dr["PowerModel"].ToString();
            BatteryModel.Text = dr["BatteryModel"].ToString();
            AirModel.Text = dr["AirModel"].ToString();
            OutFireNum.Text = dr["OutFireNum"].ToString();
            TransModel.SelectedValue = dr["TransModel"].ToString();
            BuildDate.Text = DateTime.Parse(dr["BuildDate"].ToString()).ToShortDateString();
            TowerType.SelectedValue = dr["TowerType"].ToString();
            CellPower.Text = dr["CellPower"].ToString();
            ElecInput.SelectedValue = dr["ElecInput"].ToString();
            MeterWay.SelectedValue = dr["MeterWay"].ToString();
            BillingWay.SelectedValue = dr["BILLING_WAY"].ToString();
            TransType.SelectedValue = dr["TransType"].ToString();
            AMMETERNO.Text = dr["AMMETERNO"].ToString();
        }   
        Housing_Type.SelectedValue = dr["Housing_Type"].ToString();
        Cell_Type.SelectedValue = dr["Cell_Type"].ToString();
        Mainter.Text = dr["Mainter"].ToString();
        CellOwner.SelectedValue = dr["CellOwner"].ToString();
        
    }

    private void CellList_Bind(string name)
    {
        string sqlStr = @"select distinct T1.CELL_CHNAME,t2.cell_address,T1.CELL_CLASSIFICATION
                                    from U_CELL_RELA_T T1
                                  left join cell_class T2
                                    on T1.CELL_CHNAME = T2.CELL_CHNAME
                                 WHERE T1.PHYSICAL_NAME = :PHYSICAL_NAME";
        OracleParameter[] _params = {
            new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128)
        };
        _params[0].Value = name;
        DataSet ds = OracleHelper.ExecuteDataSet(sqlStr, CommandType.Text, _params);
        Celllist.DataSource = ds;
        Celllist.DataTextField = "Cell_CHName";
        Celllist.DataValueField = "CELL_CLASSIFICATION";
        Celllist.DataBind();
        foreach (ListItem c in Celllist.Items)
        {
            c.Selected = true;
        }
        Cell_Address.Text = ds.Tables[0].Rows[0]["cell_address"].ToString();
    }

    protected void BtnCreate_Click(object sender, EventArgs e)
    {
        if (!IsOnlyPHYSICALNAME())
        {
            JQFunction("$('#LocationDiv').dialog('open');$('#MsgDiv').show();$('#JQmsg').html('站点名称已存在！');$('#PHYSICAL_NAME').focus();$('body,html').animate({scrollTop:0},1000); ");
            return;
        }
        string sqlStr = @"INSERT INTO U_PHYSICAL_LOCATION_T(PHYSICAL_NAME, CELLOWNER, OWNERSHIP, CELL_TYPE
            , HOUSING_TYPE, POWERJOIN, POWERMODEL, BATTERYMODEL, AIRMODEL, OUTFIRENUM, TRANSMODEL
            , BUILDDATE, TOWERTYPE, MAINTER, STATUS, MODIFY_DATE,CellPower,ElecInput,MeterWay,BILLING_WAY,TransType,AMMETERNO)
            VALUES(:PHYSICAL_NAME, :CELLOWNER, :OWNERSHIP, :CELL_TYPE, :HOUSING_TYPE, :POWERJOIN
            , :POWERMODEL, :BATTERYMODEL, :AIRMODEL, :OUTFIRENUM, :TRANSMODEL, :BUILDDATE, :TOWERTYPE
            , :MAINTER, :STATUS, SYSDATE,:CellPower,:ElecInput,:MeterWay,:BillingWay,:TransType,:AMMETERNO)";
        OracleParameter[] _params = {
            new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128),
            new OracleParameter(":CELLOWNER",OracleType.NVarChar,4),
            new OracleParameter(":OWNERSHIP",OracleType.NVarChar,4),
            new OracleParameter(":HOUSING_TYPE",OracleType.NVarChar,8),
            new OracleParameter(":CELL_TYPE",OracleType.NVarChar,8),
            new OracleParameter(":POWERJOIN",OracleType.VarChar,8),
            new OracleParameter(":POWERMODEL",OracleType.NVarChar,16),
            new OracleParameter(":BATTERYMODEL",OracleType.Int32),
            new OracleParameter(":AIRMODEL",OracleType.Number),
            new OracleParameter(":OUTFIRENUM",OracleType.Int32),
            new OracleParameter(":TRANSMODEL",OracleType.NVarChar,16),
            new OracleParameter(":BUILDDATE",OracleType.DateTime),
            new OracleParameter(":TOWERTYPE",OracleType.NVarChar,8),
            new OracleParameter(":MAINTER",OracleType.NVarChar,12),
            new OracleParameter(":STATUS",OracleType.NVarChar,8),
            new OracleParameter(":CellPower",OracleType.Int32),
            new OracleParameter(":ElecInput",OracleType.NVarChar,8),
            new OracleParameter(":MeterWay",OracleType.NVarChar,8),
            new OracleParameter(":BillingWay",OracleType.NVarChar,8),
            new OracleParameter(":TransType",OracleType.VarChar,64),
            new OracleParameter(":AMMETERNO",OracleType.VarChar,64)
        };
        _params[0].Value = PHYSICAL_NAME.Text.Trim();
        _params[1].Value = CellOwner.SelectedValue;
        _params[3].Value = Housing_Type.SelectedValue;
        _params[4].Value = Cell_Type.SelectedValue;
        _params[13].Value = Mainter.Text.Trim();
        _params[14].Value = "正常";
        if (CellOwner.SelectedValue.Equals("联通"))
        {
            
            _params[2].Value = Ownership.SelectedValue;                        
            _params[5].Value = PowerJoin.SelectedValue;
            _params[6].Value = PowerModel.SelectedValue;
            _params[7].Value = Int32.Parse(BatteryModel.Text.Trim());
            _params[8].Value = Decimal.Parse(AirModel.Text.Trim());
            _params[9].Value = Int32.Parse(OutFireNum.Text.Trim());
            _params[10].Value = TransModel.SelectedValue;
            _params[11].Value = DateTime.Parse(BuildDate.Text.Trim());
            _params[12].Value = TowerType.SelectedValue;            
            _params[15].Value = Int32.Parse(CellPower.Text.Trim());
            _params[16].Value = ElecInput.SelectedValue;
            _params[17].Value = MeterWay.SelectedValue;
            _params[18].Value = BillingWay.SelectedValue;
            _params[19].Value = TransType.SelectedValue;
            _params[20].Value = AMMETERNO.Text.Trim();
        }
        else
        {
            _params[2].Value = DBNull.Value;
            _params[5].Value = DBNull.Value;
            _params[6].Value = DBNull.Value;
            _params[7].Value = DBNull.Value;
            _params[8].Value = DBNull.Value;
            _params[9].Value = DBNull.Value;
            _params[10].Value = DBNull.Value;
            _params[11].Value = DBNull.Value;
            _params[12].Value = DBNull.Value;
            _params[15].Value = DBNull.Value;
            _params[16].Value = DBNull.Value;
            _params[17].Value = DBNull.Value;
            _params[18].Value = DBNull.Value;
            _params[19].Value = DBNull.Value;
            _params[20].Value = DBNull.Value;
        }
        int res = OracleHelper.ExecuteNonQuery(sqlStr, CommandType.Text, _params);
        if (res > 0)
        {
            Rela_Cell();
            Reset_Add();
            SetPager();
            SetPagerUn();
            JQueryAlert("物理站址新增成功！");
        }
    }

    private bool IsOnlyPHYSICALNAME()
    {
        string sqlStr = "SELECT Count(1) FROM U_PHYSICAL_LOCATION_T WHERE PHYSICAL_NAME=:PHYSICAL_NAME";
        OracleParameter[] _params = {
                    new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128)
                };
        _params[0].Value = PHYSICAL_NAME.Text.Trim();
        int res = Int32.Parse(OracleHelper.ExecuteScalar(sqlStr, CommandType.Text, _params).ToString());
        return (res == 0);
    }

    private void Rela_Cell()
    {
        foreach (ListItem li in Celllist.Items)
        {
            if (li.Selected)
            {
                string sqlStr = @"INSERT INTO U_CELL_RELA_T(PHYSICAL_NAME,CELL_CHNAME,CELL_CLASSIFICATION,STATUS)
                                        VALUES(:PHYSICAL_NAME,:CELL_CHNAME,:CELL_CLASSIFICATION,N'正常')";
                OracleParameter[] _params = {
                    new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128),
                    new OracleParameter(":CELL_CHNAME",OracleType.NVarChar,50),
                    new OracleParameter(":CELL_CLASSIFICATION",OracleType.NVarChar,10)
                };
                _params[0].Value = PHYSICAL_NAME.Text.Trim();
                _params[1].Value = li.Text;
                _params[2].Value = li.Value;
                OracleHelper.ExecuteNonQuery(sqlStr, CommandType.Text, _params);
            }            
        }        
    }

    private void Reset_Add()
    {
        Cell_CHName.Text = "";
        Celllist.Items.Clear();
        Cell_Address.Text = "";
        PHYSICAL_NAME.Text = "";
        CellOwner.SelectedIndex = -1;
        Ownership.SelectedIndex = -1;
        Housing_Type.SelectedIndex = -1;
        Cell_Type.SelectedIndex = -1;
        PowerJoin.SelectedIndex = -1;
        PowerModel.SelectedIndex = -1;
        BatteryModel.Text = "";
        AirModel.Text = "";
        OutFireNum.Text = "";
        TransModel.SelectedIndex = -1;
        BuildDate.Text = "";
        TowerType.SelectedIndex = -1;
        Mainter.Text = "";
        TransType.SelectedIndex = -1;
    }

    protected void BtnModify_Click(object sender, EventArgs e)
    {
        string sqlStr = @"UPDATE U_PHYSICAL_LOCATION_T SET BuildDate=:BuildDate,TowerType=:TowerType
        ,OWNERSHIP=:OWNERSHIP,HOUSING_TYPE=:HOUSING_TYPE,CELL_TYPE=:CELL_TYPE,CellOwner=:CellOwner
        ,MAINTER=:MAINTER,MODIFY_DATE=SYSDATE,PowerJoin=:PowerJoin,PowerModel=:PowerModel
        ,BatteryModel=:BatteryModel,AirModel=:AirModel,OutFireNum=:OutFireNum,TransModel=:TransModel
        ,CellPower=:CellPower,ElecInput=:ElecInput,MeterWay=:MeterWay,BILLING_WAY=:BillingWay,TransType=:TransType 
        ,AMMETERNO=:AMMETERNO WHERE PHYSICAL_NAME=:PHYSICAL_NAME AND STATUS = '正常' ";
        OracleParameter[] _params = {
            new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128),
            new OracleParameter(":OWNERSHIP",OracleType.NVarChar,8),
            new OracleParameter(":HOUSING_TYPE",OracleType.NVarChar,8),
            new OracleParameter(":CELL_TYPE",OracleType.NVarChar,8),
            new OracleParameter(":MAINTER",OracleType.NVarChar,12),
            new OracleParameter(":BuildDate",OracleType.DateTime),
            new OracleParameter(":TowerType",OracleType.NVarChar,8),
            new OracleParameter(":CellOwner",OracleType.NVarChar,4),
            new OracleParameter(":PowerJoin",OracleType.NVarChar,8),
            new OracleParameter(":PowerModel",OracleType.NVarChar,16),
            new OracleParameter(":BatteryModel",OracleType.Int32),
            new OracleParameter(":AirModel",OracleType.Number),
            new OracleParameter(":OutFireNum",OracleType.Int32),
            new OracleParameter(":TransModel",OracleType.NVarChar,16),
            new OracleParameter(":CellPower",OracleType.Int32),
            new OracleParameter(":ElecInput",OracleType.NVarChar,8),
            new OracleParameter(":MeterWay",OracleType.NVarChar,8),
            new OracleParameter(":BillingWay",OracleType.NVarChar,8),
            new OracleParameter(":TransType",OracleType.VarChar,64),
            new OracleParameter(":AMMETERNO",OracleType.VarChar,64)
        };
        _params[0].Value = PHYSICAL_NAME.Text.Trim();
        _params[2].Value = Housing_Type.SelectedValue;
        _params[3].Value = Cell_Type.SelectedValue;
        _params[4].Value = Mainter.Text.Trim();
        _params[7].Value = CellOwner.SelectedValue;
        if (CellOwner.SelectedValue.Equals("联通"))
        {
            _params[1].Value = Ownership.SelectedValue;
            _params[5].Value = DateTime.Parse(BuildDate.Text.Trim());
            _params[6].Value = TowerType.SelectedValue;
            _params[8].Value = PowerJoin.SelectedValue;
            _params[9].Value = PowerModel.SelectedValue;
            _params[10].Value = Int32.Parse(BatteryModel.Text.Trim());
            _params[11].Value = Decimal.Parse(AirModel.Text.Trim());
            _params[12].Value = Int32.Parse(OutFireNum.Text.Trim());
            _params[13].Value = TransModel.SelectedValue;
            _params[14].Value = Int32.Parse(CellPower.Text.Trim());
            _params[15].Value = ElecInput.SelectedValue;
            _params[16].Value = MeterWay.SelectedValue;
            _params[17].Value = BillingWay.SelectedValue;
            _params[18].Value = TransType.SelectedValue;
            _params[19].Value = AMMETERNO.Text.Trim();
        }
        else
        {
            _params[1].Value = DBNull.Value;
            _params[5].Value = DBNull.Value;
            _params[6].Value = DBNull.Value;
            _params[8].Value = DBNull.Value;
            _params[9].Value = DBNull.Value;
            _params[10].Value = DBNull.Value;
            _params[11].Value = DBNull.Value;
            _params[12].Value = DBNull.Value;
            _params[13].Value = DBNull.Value;
            _params[14].Value = DBNull.Value;
            _params[15].Value = DBNull.Value;
            _params[16].Value = DBNull.Value;
            _params[17].Value = DBNull.Value;
            _params[18].Value = DBNull.Value;
            _params[19].Value = DBNull.Value;
        }                                
        int res = OracleHelper.ExecuteNonQuery(sqlStr, CommandType.Text, _params);
        if (res > 0)
        {
            OldRela(PHYSICAL_NAME.Text.Trim());
            Rela_Cell();
            Reset_Add();
            SetPager();
            SetPagerUn();
            PHYSICAL_NAME.ReadOnly = false;
            JQueryAlert("物理站址更新成功！");
        }
    }

    private void OldRela(string argName)
    {
        string sqlStr = "UPDATE U_CELL_RELA_T SET  STATUS='删除' WHERE PHYSICAL_NAME = :PHYSICAL_NAME";
        OracleParameter[] _params = {
                    new OracleParameter(":PHYSICAL_NAME",OracleType.NVarChar,128)
                };
        _params[0].Value = argName;
        OracleHelper.ExecuteNonQuery(sqlStr, CommandType.Text, _params);
    }

    protected void LocationPager_PageChanged(object sender, EventArgs e)
    {
        SetPager();
    }

    protected void AddLocation_Click(object sender, EventArgs e)
    {
        BtnCreate.Visible = true;
        BtnCreate.Enabled = true;
        BtnModify.Visible = false;
        Reset_Add();
        Page.ClientScript.RegisterStartupScript(this.GetType(), "open"
            , "$(function() {$('#LocationDiv').dialog('open');})", true);
    }

    protected void Search_Cell_Click(object sender, EventArgs e)
    {
        string sqlStr = "select cell_chname,cell_address,CELL_CLASSIFICATION from CELL_CLASS where cell_chname like '%" + Tools.ReplaceString(Cell_CHName.Text.Trim(), 64) + "%'";
        if (Dep_A.SelectedValue != "0")
        {
            sqlStr += "  and cell_chname like '" + Dep_A.SelectedValue + "%' ";
        }
        DataSet ds = OracleHelper.ExecuteDataSet(sqlStr, CommandType.Text, null);
        Celllist.DataSource = ds;
        Celllist.DataTextField = "cell_chname";
        Celllist.DataValueField = "CELL_CLASSIFICATION";
        Celllist.DataBind();
        if (ds.Tables[0].Rows.Count > 0)
        {
            Cell_Address.Text = ds.Tables[0].Rows[0]["cell_address"].ToString();
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "open"
            , "$(function() {$('#LocationDiv').dialog('open');})", true);
    }

    protected void UnCellPager_PageChanged(object sender, EventArgs e)
    {
        SetPagerUn();
    }    
}
